LAGOS Analysis

Loading in data

First download and then specifically grab the locus (or site lat longs)

# #Lagos download script
LAGOSNE::lagosne_get(dest_folder = LAGOSNE:::lagos_path())
## Warning in LAGOSNE::lagosne_get(dest_folder = LAGOSNE:::lagos_path()): LAGOSNE data for this version already exists on the local machine.
##   Re-download if neccessary using the 'overwrite` argument.'
#Load in lagos
lagos <- lagosne_load()
## Warning in (function (version = NULL, fpath = NA) : LAGOSNE version unspecified,
## loading version: 1.087.3
#Grab the lake centroid info
lake_centers <- lagos$locus

Convert to spatial data

#Look at the structure
str(lake_centers)
## 'data.frame':    141265 obs. of  18 variables:
##  $ lagoslakeid      : int  1 2 3 4 5 6 7 8 9 10 ...
##  $ nhdid            : chr  "50524769" "123632625" "50524793" "135695054" ...
##  $ gnis_name        : chr  NA "Benton Pond" NA "Wedge Pond" ...
##  $ nhd_lat          : num  42.5 42.2 42.5 42.5 42.6 ...
##  $ nhd_long         : num  -73.2 -73 -73.2 -71.1 -70.8 ...
##  $ lake_area_ha     : num  114.95 24.87 75.41 9.26 14 ...
##  $ lake_perim_meters: num  9296 2939 5822 1417 2013 ...
##  $ nhd_fcode        : int  43613 39009 43613 39004 39004 39010 39004 39004 39004 39004 ...
##  $ nhd_ftype        : int  436 390 436 390 390 390 390 390 390 390 ...
##  $ iws_zoneid       : chr  "IWS_45400" "IWS_41585" "IWS_44511" "IWS_42712" ...
##  $ hu4_zoneid       : chr  "HU4_12" "HU4_7" "HU4_12" "HU4_10" ...
##  $ hu6_zoneid       : chr  "HU6_15" "HU6_10" "HU6_15" "HU6_11" ...
##  $ hu8_zoneid       : chr  "HU8_49" "HU8_41" "HU8_49" "HU8_35" ...
##  $ hu12_zoneid      : chr  "HU12_16694" "HU12_16612" "HU12_16694" "HU12_16625" ...
##  $ edu_zoneid       : chr  "EDU_75" "EDU_27" "EDU_75" "EDU_58" ...
##  $ county_zoneid    : chr  "County_319" "County_319" "County_319" "County_326" ...
##  $ state_zoneid     : chr  "State_2" "State_2" "State_2" "State_2" ...
##  $ elevation_m      : num  295.86 447.83 295.86 4.26 13.65 ...
spatial_lakes <- st_as_sf(lake_centers,coords=c('nhd_long','nhd_lat'),
                          crs=4326) %>%
  st_transform(2163)

#Subset for plotting
subset_spatial <- spatial_lakes %>%
  slice(1:100) 

subset_baser <- spatial_lakes[1:100,]

#Dynamic mapviewer
mapview(subset_spatial)

Subset to only Minnesota

states <- us_states()

#Plot all the states to check if they loaded
#mapview(states)
minnesota <- states %>%
  filter(name == 'Minnesota') %>%
  st_transform(2163)

#Subset lakes based on spatial position
minnesota_lakes <- spatial_lakes[minnesota,]

#Plotting the first 1000 lakes
minnesota_lakes %>%
  arrange(-lake_area_ha) %>%
    slice(1:1000) %>%
  mapview(.,zcol = 'lake_area_ha')

In-Class work

1) Show a map outline of Iowa and Illinois (similar to Minnesota map upstream)

ILIA <- states %>%
  filter(name == 'Illinois' | name == 'Iowa') %>%
  st_transform(2163)

# view outline of Illinois and Iowa
mapview(ILIA)
#Subset lakes based on spatial position
ILIA_lakes <- spatial_lakes[ILIA,] %>% 
    mutate(lake_area_logha = log(lake_area_ha))

#Plotting the first 1000 lakes
ILIA_lakes %>%
  arrange(-lake_area_ha) %>%
    slice(1:1000) %>%
  mapview(.,zcol = 'lake_area_ha')

2) Subset LAGOS data to these sites, how many sites are in Illinois and Iowa combined? How does this compare to Minnesota?

Minnesota has many more lakes (29,038) than Illinois and Iowa combined (16,466). That’s more than the land of 10,000 lakes!

length(unique(minnesota_lakes$lagoslakeid))
## [1] 29038
length(unique(ILIA_lakes$lagoslakeid))
## [1] 16466

3) What is the distribution of lake size in Iowa vs. Minnesota?

There are many more lakes in Minnesota than Iowa. Minnesota lakes are much larger on average and overall have a larger spread of lake size.

#create iowa lakes file
iowa <- states %>%
  filter(name == 'Iowa') %>%
  st_transform(2163)

iowa_lakes <- spatial_lakes[iowa,]

sum(iowa_lakes$lake_area_ha)
## [1] 51181.6
sum(minnesota_lakes$lake_area_ha)
## [1] 1208191
#combine ia and mn data, add statename to lake
MNIA_lakes <- rbind(iowa_lakes %>% mutate(state="Iowa",total_area=sum(lake_area_ha)),minnesota_lakes %>% mutate(state="Minnesota",total_area=sum(lake_area_ha))) %>% 
  mutate(lake_area_logha = log(lake_area_ha))
           
ggplot(MNIA_lakes,aes(lake_area_logha)) +
  geom_histogram(bins=25) +
  facet_wrap(~state)

ggplot(MNIA_lakes,aes(lake_area_logha)) +
  geom_boxplot() +
  facet_wrap(~state) +
  coord_flip()

4) Make an interactive plot of lakes in Iowa and Illinois and color them by lake area in hectares

#Plotting the first 1000 lakes
ILIA_lakes %>%
  arrange(-lake_area_logha) %>%
  mapview(.,zcol = 'lake_area_logha')

5) What other data sources might we use to understand how reservoirs and natural lakes vary in size in these three states?

This analysis has potential to be improved by incorporating other data!

Other data sources could include state records of lakes, satellite imagery of lake boundaries over time, property records, or other research efforts.

It would also be interesting to see how sizes of waterbodies vary when comparing reservoirs vs. natural lakes, and what percent of lakes are natural between the three states. I’d be curious to see if the definition of a “lake” varies between any of these states as well. I’d also like to know how these numbers have changed over time, either in the creation/destruction of lakes, or natural changes to lake boundaries.